<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <title>后台编辑</title>
    <link rel="stylesheet" href="../../static/css/semantic.min.css" th:href="@{/css/semantic.min.css}">
    <link rel="stylesheet" href="../../static/css/icon.min.css" th:href="@{/css/icon.min.css}">
    <link rel="stylesheet" href="../../static/css/mine.css" th:href="@{/css/mine.css}">
    <link rel="stylesheet" href="../../static/lib/editormd/css/editormd.min.css"
          th:href="@{/lib/editormd/css/editormd.min.css}">
</head>

<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="../../static/js/semantic.min.js" th:src="@{/js/semantic.min.js}"></script>
<script src="../../static/lib/editormd/editormd.min.js" th:src="@{/lib/editormd/editormd.min.js}"></script>

<body>
<!--导航 -->
<nav th:replace="admin/_fragments::menu(3)" class="ui inverted attached segment mine-padded-tb-mini">
</nav>
<div class="ui attached pointing menu">
    <div class="ui container">
        <div class="right menu">
            <a href="#" class="item active">发布</a>
            <a href="#" class="teal  item">列表</a>
        </div>
    </div>
</div>
<!-- 中间内容 -->
<div class="mine-container mine-padded-tb-large">
    <div class="ui container">
        <form action="#" method="post" th:action="@{/admin/blogs/add}" class="ui form">
            <div class="required field">
                <div class="ui left labeled input">
                    <div id="blog-type" class="ui dropdown selection compact teal basic  label">
                        <input type="hidden" name="blogType" value="0">
                        <i class="dropdown icon"></i>
                        <div class="text">原创</div>
                        <div class="menu">
                            <div class="item" data-value="0">原创</div>
                            <div class="item" data-value="1">翻译</div>
                            <div class="item" data-value="2">转载</div>
                        </div>
                    </div>
                    <input type="text" id="title" name="title" th:value="${blog}!=null ? ${blog.title}" placeholder="标题">
                </div>
            </div>

            <div class="field">
                <div id="md-content" style="z-index: 1 !important;">
                    <textarea th:text="${blog}!=null ? ${blog.content}" placeholder="笔记内容" name="content"
                              style="display: none"></textarea>
                </div>
            </div>

            <div class="two fields">
                <div class="field">
                    <div class="ui left labeled input">
                        <label class="ui compact teal basic label">分类</label>
                        <div class="ui fluid selection dropdown">
                            <input type="hidden" name="typeId">
                            <i class="dropdown icon"></i>
                            <div class="default text">分类</div>
                            <div class="menu">
                                <div th:each="type : ${types}" th:data-value="${type.id}" th:text="${type.name}"
                                     class="item" data-value="1"></div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="field">
                    <div class="ui left labeled input">
                        <label class="ui compact teal basic  label">标签</label>
                        <div class="ui fluid selection dropdown multiple search">
                            <input type="hidden" name="tagIds">
                            <i class="dropdown icon"></i>
                            <div class="default text">标签</div>
                            <div class="menu">
                                <div th:each="tag : ${tags}" th:data-value="${tag.id}" th:text="${tag.name}"
                                     class="item" ></div>
                                <!--<div class="item" data-value="1">web开发</div>-->
                                <!--<div class="item" data-value="2">大数据</div>-->
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="field">
                <div class="ui left labeled input">
                    <label class="ui teal basic label">首图</label>
                    <input type="text" name="indexPicture" th:value="${blog} != null ? ${blog.firstPicInfo}" placeholder="首图引用地址">
                </div>
            </div>

            <div class="field">
                <div style="z-index: 1 !important;">
                    <textarea placeholder="笔记内容简介" name="desc" th:text="${blog}!=null ? ${blog.desc}" ></textarea>
                </div>
            </div>

            <div class="inline fields">
                <div class="field">
                    <div class="ui checkbox">
                        <input type="checkbox" id="recommend" name="recommend" th:checked="${blog}!=null and ${blog.recommend} ? true" class="hidden">
                        <label for="recommend">推荐</label>
                    </div>
                </div>
                <div class="field">
                    <div class="ui checkbox">
                        <input type="checkbox" id="shareInfo" name="shareInfo" th:checked="${blog}!=null and ${blog.shareStatement} ? true" class="hidden">
                        <label for="shareInfo">转载声明</label>
                    </div>
                </div>
                <div class="field">
                    <div class="ui checkbox">
                        <input type="checkbox" id="appreciation" name="appreciation" th:checked="${blog}!=null and ${blog.appreciation}==1 ? true" class="hidden">
                        <label for="appreciation">打赏</label>
                    </div>
                </div>
                <div class="field">
                    <div class="ui checkbox">
                        <input type="checkbox" id="commend" name="commend" th:checked="${blog}!=null and ${blog.comented}==1 ? true" class="hidden">
                        <label for="commend">评论</label>
                    </div>
                </div>
            </div>

            <div class="ui right aligned container">
                <button type="button" class="ui button" onclick="window.history.go(-1)">返回</button>
                <button class="ui secondary button">保存</button>
                <button class="ui teal button"  id="published" name="published" th:value="true" onclick="">发布</button>
            </div>

        </form>
    </div>
</div>
<!-- 底部 -->
<footer th:replace="admin/_fragments::footer" class="ui inverted vertical segment mine-padded-tb-massive">
</footer>
<script>
    var testEditor;

    $(function () {
        testEditor = editormd("md-content", {
            width: "100%",
            height: 666,
            syncScrolling: "single",
            path: "/lib/editormd/lib/"
        });
    });
    $('.ui.dropdown').dropdown({
        on: 'hover'
    });


</script>
</body>
</html>